#include <iostream>
using namespace std;

template<typename T>
class Base : public T {
    public:
        void test() {
            static_cast<const T*>(this)->test();
        }
};

class Derived1 {
    public:
        void test() const {
            cout << "Derived1" << endl;
        }
};

class Derived2 {
    public:
        void test() const {
            cout << "Derived2" << endl;
        }
};

int main() {
    Base<Derived1> b1;
    Base<Derived2> b2;
    b1.test();
    b2.test();
    return 0;
}
